<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="https://unpkg.com/vue@next"></script>

    <style>
        .box{
            width: 100px;
            height: 100px;
            background: red;
        }

        .box2{
            width: 200px;
            height: 200px;
            background: yellow;
        }

        .rt{
            float:right;
        }

    </style>
</head>
<body>
<div id="app">
    <div :class="cls">box111</div>
    <div :class="cls2">box222</div>
    <div :class="cls3">box333</div>
    <button type="button" @click="changeCss">更换样式</button>
</div>
</body>
<script>
    const app = Vue.createApp({
        data() {
            return {
                // 绑定单个样式，直接写样式名
                cls:'box',
                // 如果元素绑定多个样式，可以使用数组
                cls2:['box','rt'],
                // 如果元素绑定多个样式，也可以使用对象
                cls3:{
                    box2:true,
                    rt:true
                }
            }
        },
        methods:{
            changeCss(){
                this.cls =['box2'];
            }
        }
    }).mount("#app")
</script>
</html>